﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Telerik.Web.Mvc;
using Sisocana.Core;
using Sisocana.Core.Interfaces;

namespace Sisocana.Controllers
{
    public class gridController : Controller
    {
       
        
        private IDonacionService _donacionService;
        private IPersonaService _personaService;
        
        public gridController()
            : this(new DonacionService(),new PersonaService())
        {

        }

        public gridController(IDonacionService donacionService, IPersonaService personaService)
        {
            _donacionService = donacionService;
            _personaService = personaService;
        }
        
        
        
        
        
        
        public ActionResult FirstLook(int?id,bool? ajax, bool? scrolling, bool? paging, bool? filtering, bool? sorting,
            bool? grouping, bool? showFooter)
        {
           
            ViewData["ajax"] = ajax ?? true;
            ViewData["scrolling"] = scrolling ?? true;
            ViewData["paging"] = paging ?? true;
            ViewData["filtering"] = filtering ?? true;
            ViewData["grouping"] = grouping ?? true;
            ViewData["sorting"] = sorting ?? true;
            ViewData["showFooter"] = showFooter ?? true;
            ViewData["idSitio"] = id;
            return View(_donacionService.GetAllDonacionBienes(c => c.idSitio == id));
        }
        [GridAction]
        public ActionResult _FirstLook(int? id)
        {
            ViewData["idSitio"] = id;
            return View(new GridModel(_donacionService.GetAllDonacionBienes(c => c.idSitio == id)));
        }


    }
}
